﻿using System;

namespace Borg.AddOn
{
    [Serializable]
    internal sealed class TypeStoreModifierApiHookChain : ITypeStoreModifierApiHook
    {
        private readonly ITypeStoreModifierApiHook[] _hooks;

        public TypeStoreModifierApiHookChain(ITypeStoreModifierApiHook[] hooks)
        {
            _hooks = hooks;
        }

        public void OnModification(TypeStoreModificationOperation operation, Contract contract)
        {
            foreach (ITypeStoreModifierApiHook hook in _hooks)
                hook.OnModification(operation, contract);
        }

        public void OnModification(TypeStoreModificationOperation operation, Plugin plugin)
        {
            foreach (ITypeStoreModifierApiHook hook in _hooks)
                hook.OnModification(operation, plugin);
        }
    }
}
